package com.javatest.springboottask.service;

import java.util.concurrent.TimeUnit;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/4/24 14:39
 */
@Service
public class AsyncService {

    /**
     * 告诉spring这是一个异步方法
     */
    @Async
    public void hello() {
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("processing...");
    }
}
